Last report can't be cleared.
Good Day, here is my problem, using the above code i can print my first report correctly, but the next reports are just the same as the first one, after some experimentation i figured out that Report.PrepareReport does not clear the report as it is supposed to do, so what may be the problem ?
Thanks
Var
  S, TmpName, TmpId: String;
  FrxDataSet: TFrxDBDataSet;
  Report: TFrxReport;
  TmpQ, TmpQ2: TZQuery;
  Stream: TStream;
begin
  TmpName := CurrentEntity.GetEntityName;
  TmpId := IntToStr(GridViewOne.Controller.FocusedRow.Values[0]);
  Report := TFrxReport.Create(FormEntityGrid);
  Report.Clear;
  TmpQ := OpenQuery(Global_Singleton_DbConnection,
    'SELECT REPORT FROM wisp_reports WHERE NAME="' + TmpName +
    '" AND TYPE="SINGLE";').ZQuery;
  Stream := TmpQ.CreateBlobStream(TmpQ.FieldByName('REPORT'), bmRead);
  Stream.Position := 0;
  Report.LoadFromStream(Stream);
  TmpQ.Free;
  S := Global_Singleton_EntityManager.GetEntityByName(TmpName)
    .GetInstanceQueryString(TmpId);
  TmpQ2 := OpenQuery(Global_Singleton_DbConnection, S).ZQuery;
  FrxDataSet := TFrxDBDataSet.Create(Global_Singleton_DbConnection);
  FrxDataSet.UserName := 'Report';
  FrxDataSet.DataSet := TmpQ2;
  Report.DataSets.Items[0].DataSet := FrxDataSet;
  Report.PrepareReport(TRUE);
  Report.ShowReport;
  TmpQ2.Free;
Thanks
Comments
FrxDataSet.Free;
after
Report.ShowReport(True);
comment
Report.PrepareReport(TRUE);
Thanks for your reply, but what you suggested does not work